home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2004 November / PCWNOV04.iso / Software / Full / Cyberlink MediaShow v2 / Setup / data1.cab / MediaShow_File_Group / www / SelBrowser.js < prev   
Encoding:
Text File  |  2003-05-20  |  3.6 KB  |  119 lines

  1. <!-- hide script from old browsers
  2. var netscape_required = 4.07
  3. var explorer_required = 4.0
  4.  
  5. var navigator_name = navigator.appName;
  6. var navigator_version = parseFloat(navigator.appVersion);
  7. var IE4=false;
  8. var NN4=false;
  9.  
  10. var OLD_NETSCAPE = "Medi@Show SmartUpdate requires Netscape version " +
  11.                    netscape_required + " or higher, " +
  12.                    "but you appear to be running version " + navigator_version +
  13.                    ". Click <a href=\"http://home.netscape.com/download/\">here</a> to upgrade!<P>";
  14.  
  15. var OLD_EXPLORER = "Medi@Show ActiveX Control requires Internet Explorer version " +
  16.                     explorer_required + " or higher, " +
  17.                    "but you appear to be running version " + navigator_version +
  18.                    ". Click <a href=\"http://www.microsoft.com/windows/ie/download/\">here</a> to upgrade!<P>";
  19.  
  20. var UNKNOWN_BROWSER = "This is a unknown browser. " + 
  21.                       "Medi@Show Plug-in or ActiveX Control contained in this page cannot be viewed correctly!<P>";
  22.  
  23. if (navigator_name == "Netscape")
  24. {
  25.   if (navigator_version < netscape_required)
  26.     document.write("<P>" + OLD_NETSCAPE + "\n");
  27.   else
  28.     NN4=true;
  29. }
  30. else if (navigator_name == "Microsoft Internet Explorer") 
  31. {
  32.   if (navigator_version < explorer_required)
  33.     document.write("<P>" + OLD_EXPLORER + "\n");
  34.   else 
  35.     IE4=true;
  36. }
  37. else 
  38. {
  39.   document.write("<P>" + UNKNOWN_BROWSER + "\n");
  40. }
  41.  
  42. function JarLocation()
  43. {
  44.     var window_href = window.location.href;
  45.     var length = window_href.length;
  46.  
  47.     for(i=length; i>0; i--)
  48.     {  
  49.         if(window_href.charAt(i) == "\\" || window_href.charAt(i) == "/")
  50.         {  
  51.             index = i;
  52.             break;
  53.         }
  54.     }
  55.  
  56.     return window_href.substring(0, index);
  57. }
  58.  
  59. // SmartUpdate trigger script for the Medi@Show Plug-In
  60. function comm4SmartUpdatePlugIn(force)
  61. {
  62.     if (navigator.javaEnabled()) 
  63.     { 
  64.         trigger = netscape.softupdate.Trigger;
  65.  
  66.         // Check if JAR Installation Manager is enabled
  67.         if (trigger.UpdateEnabled()) 
  68.         {
  69.             var file_path;
  70.  
  71.             version_no = new netscape.softupdate.VersionInfo(1,0,0,5);
  72.             file_path = JarLocation();
  73.             trigURL = file_path + "/" + "MediaShow.jar";
  74.  
  75.             if (!force) 
  76.             {
  77.                 if (trigger.ConditionalSoftwareUpdate(trigURL, "plugins/MediaShow/", version_no, trigger.DEFAULT_MODE))
  78.                     // It means SmartUpdate is starting
  79.                     return true;
  80.             } 
  81.             else
  82.             {
  83.                 trigger.StartSoftwareUpdate(trigURL, trigger.FORCE_MODE);
  84.                     // It means SmartUpdate is starting
  85.                     return true;
  86.             }
  87.  
  88.          }
  89.     }
  90.  
  91.     return false;
  92. }
  93.  
  94. function MediaShowObject(flzname,width,height)
  95. {  
  96.    if(IE4)
  97.    {
  98.     document.write('<OBJECT    ID="SequenceCtl" WIDTH="'+width+'" HEIGHT="'+height+'"');
  99.     document.write('CLASSID="CLSID:5DBF08EF-4BDE-11D3-B8E4-0080C84E9C66"');
  100.     document.write('CODEBASE="MediaShow.cab#Version=1,0,0,5">');
  101.     document.write('<PARAM  NAME="File" VALUE="'+flzname+'">');
  102.     document.write('</OBJECT>');
  103.    }
  104.    
  105.    if(NN4)
  106.    {    
  107.     if (comm4SmartUpdatePlugIn(false) == false)
  108.     {
  109.       document.write('<EMBED  SRC="'+flzname+'"WIDTH="'+width+'" HEIGHT="'+height+'">');
  110.     } 
  111.     else
  112.     {
  113.       document.write('<A HREF="javascript:window.location.reload();">');
  114.       document.write('<IMG BORDER="0" SRC ="MediaShowPlugin.jpg" WIDTH="'+width+'" HEIGHT="'+height+'">');
  115.       document.write('</A>');
  116.     }
  117.    }  
  118. }
  119. // end script hiding from old browsers -->